<template>
    <main>
        <SearchBar></SearchBar>
        <Teleport to="body">
            <Dialog></Dialog>
        </Teleport>
        <List></List>
    </main>
</template>
<script setup>
import SearchBar from "./SearchBar.vue";
import Dialog from "./Dialog.vue";
import List from "./list/List.vue";

onMounted(async() => {
    myApi.openDialog();
    myApi.onRendererEvent(cbClick);
});
// 回调函数
const cbClick=(action)=>{
    if(action==='add'){
        setIsDialogFormVisible(true);
    }
}
// Dialog显示状态
const dialogFormVisible = ref(false);
const setIsDialogFormVisible = (val) => {
    dialogFormVisible.value = val;
};
provide("dialog-Visible", {
    dialogFormVisible,
    setIsDialogFormVisible,
});
// 搜索
const keywords = ref("");

const setkeywords = (val) => {
    keywords.value = val;
};

provide("search-url", {
    keywords,
    setkeywords,
});
</script>
<style scoped>

</style>
